<template>
	<view class="page">
		<view class="header">
			<view class="title_box">
				<view class="header_left"></view>
				<view class="title">我的</view>
				<view class="icon_r" @click="toWhere('set')">
					<image class="msg" src="/static/icon/set.png" mode="scaleToFill" />
				</view>
			</view>
		</view>
		<view class="head" :class="isShow == 0 ? 'bj' : ''">
			<image src="/static/icon/head.png" mode="scaleToFill" class="headImg" />
			<view class="head_right" v-if="showAuto == 1">
				<text class="phoneNumber">{{ phone }}</text>
				<view class="auto">
					<text>实名认证提额</text>
					<u-icon name="arrow-right-double" color="#2979ff" size="24">&nbsp;&nbsp;&nbsp;</u-icon>
				</view>
			</view>
			<view class="head_right1" v-else>{{ phone }}</view>
		</view>
		<!-- 产品 -->
		<view class="content u-skeleton" v-if="isShow">
			<view class="con_top">
				<image class="con_pic" :src="product.logo" mode="scaleToFill" />
				<view class="con_title">
					<view class="title">{{ product.product_name }}</view>
					<view class="maxNum">{{ product.quota_max * 10000 }}</view>
					<view class="dec">最高可借额度（元）</view>
				</view>
				<view class="con_right headle">领取我的额度</view>
			</view>
			<view class="con_bottom">
				<text>最长期限{{ product.term_max }}个月</text>
				<view class="blue_line"></view>
				<text>年化利率低至{{ product.rate }}%</text>
				<view class="blue_line"></view>
				<text>快至{{ product.quick_loan_time }}小时放款</text>
			</view>
			<image src="/static/icon/bj.png" mode="scaleToFill" class="bj" />
		</view>
		<view class="center">
			<view class="myData" @click="toWhere('myData')">
				<view><image src="/static/icon/ziliao.png" mode="scaleToFill" /></view>
				<text>我的资料</text>
			</view>
			<view class="service" @click="toWhere('service')">
				<view><image src="/static/icon/kefub.png" mode="scaleToFill" /></view>
				<text>联系客服</text>
			</view>
		</view>
		<view class="list" @click="toWhere('deal')">
			<image src="/static/icon/xieyi.png" mode="scaleToFill" class="list_img" />
			<view>协议列表</view>
		</view>
		<view class="list" @click="toWhere('about')">
			<image src="/static/icon/women.png" mode="scaleToFill" class="list_img" />
			<view>关于我们</view>
		</view>
		<view class="list" @click="toWhere('update')">
			<image src="/static/icon/gengxin.png" mode="scaleToFill" class="list_img" />
			<view>检查更新</view>
		</view>
		<!--引用组件-->
		<u-skeleton :loading="loading" :animation="true" bgColor="#F5F6FA"></u-skeleton>
		<!-- <view class="edgeInsetBottom"></view> -->
		<!-- 绝对定位的视图需要考虑 tabBar 遮挡的问题，bottom 应该加上 tabBar 的高度 -->
		<!-- <view class="fixedView"></view> -->
	</view>
</template>

<script>
import api from '@/api'
export default {
	components: {},
	data() {
		return {
			loading: true,
			// 是否显示产品
			isShow: 1,
			showAuto: 0,
			phone: '',
			product: {}
		}
	},
	computed: {},
	watch: {},
	onLoad() {
		this.getUserInfo()
	},
	onShow() {},
	onReady() {},
	// 方法集合
	methods: {
		async getUserInfo() {
			try {
				const res = await api.my({})
				this.phone = res.phone
				this.showAuto = res.is_fill_info
				this.isShow = res.is_show_product
				this.product = res.product
				this.loading = false
			} catch (e) {
				console.log(e)
			}
		},
		toWhere(url) {
			uni.navigateTo({
				url: `/pages/my/${url}?phone=${this.phone}`
			})
		}
	},
	onHide() {},
	onUnload() {}
}
</script>
<style lang="scss" scoped>
.page {
	color: #000;
	width: 100%;
	text-align: center;
	position: relative;
	font-family: PingFang SC;
}
// 头部导航
.header {
	position: relative;
	top: 0;
	left: 0;
	width: 100%;
	height: auto;
	padding-top: var(--status-bar-height);
	z-index: 10;
	background-color: #3478f2;
	color: rgba(255, 255, 255, 0.8);
	.title_box {
		height: 44px;
		padding: 0 32rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.header_left {
			width: 32rpx;
		}
		.title {
			font-size: 40rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #ffffff;
		}
		.icon_r {
			width: 32rpx;
			height: 32rpx;
			.msg {
				width: 100%;
				height: 100%;
			}
		}
	}
}
.setIcon {
	position: absolute;
	top: -60rpx;
	right: 30rpx;
	width: 39rpx;
	height: 39rpx;
	z-index: 3;
}
.edgeInsetBottom {
	width: 750rpx;
	height: var(--window-bottom);
}

.fixedView {
	position: fixed;
	width: 750rpx;
	height: 30px;
	bottom: var(--window-bottom);
}
// 个人信息样式
.head {
	display: flex;
	padding: 56rpx 0rpx 42rpx 32rpx;
	.headImg {
		width: 104rpx;
		height: 104rpx;
		margin-right: 22rpx;
	}
	.head_right1 {
		height: 104rpx;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #333333;
		line-height: 104rpx;
		margin-left: 16rpx;
	}
	.head_right {
		.phoneNumber {
			display: block;
			line-height: 40rpx;
			font-size: 28rpx;
			margin-bottom: 4rpx;
			margin-top: 4rpx;
		}
		.auto {
			height: 52rpx;
			width: 236rpx;
			background: #e4eeff;
			border: 1rpx solid #0780fe;
			border-radius: 32rpx;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #3478f2;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-left: 28rpx;
			padding-right: 24rpx;
		}
	}
}
.bj {
	background-color: #fff;
}
.content {
	width: 100vw;
	height: 368rpx;
	background: #ffffff;
	padding: 24rpx 32rpx;
	position: relative;
	.con_top {
		display: flex;
		.con_pic {
			width: 80rpx;
			height: 80rpx;
			border-radius: 16rpx;
		}
		.con_title {
			margin-left: 24rpx;
			.title {
				font-size: 32rpx;
				color: #333333;
				font-weight: bold;
				line-height: 80rpx;
			}
			.maxNum {
				font-size: 64rpx;
				font-weight: 800;
				line-height: 90rpx;
				color: #fc1f1f;
			}
			.dec {
				margin-top: 10rpx;
				font-size: 28rpx;
				font-weight: 400;
				line-height: 40rpx;
				color: #bdbdbb;
			}
		}
		.con_right {
			margin-left: 104rpx;
			width: 196rpx;
			height: 60rpx;
			background: #3478f2;
			border-radius: 50rpx;
			color: #ffffff;
			line-height: 60rpx;
			margin-top: 164rpx;
		}
	}
	.con_bottom {
		margin-top: 36rpx;
		width: 686rpx;
		height: 60rpx;
		background: #e4eeff;
		border-radius: 8rpx;
		color: #0780fe;
		font-size: 24rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		.blue_line {
			height: 26rpx;
			width: 2rpx;
			background-color: #0780fe;
		}
		text {
			padding-left: 10rpx;
			padding-right: 12rpx;
		}
	}
	.bj {
		width: 130rpx;
		height: 134rpx;
		position: absolute;
		top: 0;
		right: 0;
	}
}
.center {
	display: flex;
	justify-content: space-between;
	padding: 40rpx 32rpx;
}
.center > view {
	width: 292rpx;
	height: 172rpx;
	background: #ffffff;
	border-radius: 16rpx;
	padding: 22rpx 100rpx 18rpx 96rpx;
	image {
		width: 88rpx;
		height: 88rpx;
	}
	text {
		font-size: 24rpx;
		font-weight: 400;
		color: #333333;
	}
}
.list {
	width: 100vw;
	height: 84rpx;
	background-color: #ffffff;
	padding: 14rpx 0 16rpx 32rpx;
	display: flex;
	align-items: center;
	margin-bottom: 24rpx;
	.list_img {
		width: 55rpx;
		height: 55rpx;
	}
	view {
		margin-left: 14rpx;
	}
}
</style>
